﻿<Window x:Class="MetaDesigner.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:customCommands="clr-namespace:MetaDesigner.CustomCommands"
        xmlns:local="clr-namespace:MetaDesigner"
        xmlns:DataModel="clr-namespace:DataModel;assembly=DataModel"
        Title="Helux - SharePoint Information Architecture Designer" MinHeight="500" MinWidth="700" Icon="ico/HeluxIcon.png" 
        WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing" Closed="Window_Closed">
    <Window.CommandBindings>
        <CommandBinding Command="New" Executed="NewCommandBinding_Executed" />
        <CommandBinding Command="Open" Executed="OpenCommandBinding_Executed" />
        <CommandBinding Command="Save" Executed="SaveCommandBinding_Executed" />
        <CommandBinding Command="SaveAs" Executed="SaveAsCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.RenameCommand" Executed="RenameCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ReportCommand" Executed="ReportCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ExitCommand" Executed="ExitCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.SPFetchCommand" Executed="SPFetchBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.SPDeployCommand" Executed="SPDeployBinding_Executed" />
        <!-- content type specific bindings -->
        <CommandBinding Command="customCommands:Commands.AddContentTypeCommand" Executed="AddContentTypeCommandBinding_Executed" />
        <!-- Site column tab specific bindings -->
        <CommandBinding Command="customCommands:Commands.AddSiteColumnCommand" Executed="AddSiteColumnCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.RenameSiteColumnCommand" Executed="RenameSiteColumnCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.DeleteSiteColumnCommand" Executed="DeleteSiteColumnCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.PopupSiteColumnMetadataTagsCommand" Executed="PopupSiteColumnMetadataTagsCommandBinding_Executed"/>
        <CommandBinding Command="customCommands:Commands.ManageSiteColumnMetadataTagsCommand" Executed="ManageSiteColumnMetadataTagsCommandBinding_Executed"/>
        <!-- managed metadata tab specific bindings -->

        <CommandBinding Command="customCommands:Commands.ManagePropertiesForTermSet" Executed="ManagePropertiesForTermSetCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ChangeGroupForTermSetCommand" Executed="ChangeGroupForTermSetCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.AddTermSetCommand" Executed="AddTermSetCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.RenameTermSetCommand" Executed="RenameTermSetCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.DeleteTermSetCommand" Executed="DeleteTermSetCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.DeleteTermCommand" Executed="DeleteTermCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.AddTermCommand" Executed="AddTermCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.AddRootTermCommand" Executed="AddRootTermCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.RenameTermCommand" Executed="RenameTermCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ToggleTaggableCommand" Executed="ToggleTaggableCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ExpandAllTreeItemCommand" Executed="ExpandAllTreeItemCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.CollapseAllTreeItemCommand" Executed="CollapseAllTreeItemCommandBinding_Executed" />
        <CommandBinding Command="customCommands:Commands.ManagePropertiesForTerm" Executed="ManagePropertiesForTermCommandBinding_Executed" />
    </Window.CommandBindings>
    <Window.InputBindings>
        <KeyBinding Key="X" Modifiers="Control" Command="customCommands:Commands.ExitCommand" />
        <KeyBinding Key="F" Modifiers="Control+Shift" Command="SaveAs" />
    </Window.InputBindings>
    <Window.Resources>
        <Style TargetType="TreeViewItem">
            <Style.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="2"/>
                </Style>
            </Style.Resources>
        </Style>
        <Image x:Key="saveIcon" Source="ico/save_as.png" Height="13" Width="13" />
        <Image x:Key="openIcon" Source="ico/folder.png" Height="13" Width="13" />
        <Image x:Key="deleteIcon" Source="ico/delete.png" Height="13" Width="13" />
        <Image x:Key="deployIcon" Source="ico/upload.png" Height="13" Width="13" />
        <Image x:Key="importIcon" Source="ico/download.png" Height="13" Width="13" />
        <Image x:Key="cutIcon" Source="ico/cut.png" Height="13" Width="13" />
        <Image x:Key="copyIcon" Source="ico/copy.png" Height="13" Width="13" />
        <Image x:Key="validateIcon" Source="ico/checkmark.png" Height="13" Width="13" />
        <Image x:Key="newTermSetIcon" Source="ico/add_folder.png" Height="13" Width="13" />
        <Image x:Key="infoIcon" Source="ico/info.png" Height="13" Width="13" />
        <Image x:Key="plusIcon" Source="ico/plus.png" Height="13" Width="13" />
        <Image x:Key="minusIcon" Source="ico/minus.png" Height="13" Width="13" />
        <Image x:Key="editIcon" Source="ico/edit.png" Height="13" Width="13" />
        <Image x:Key="tagIcon" Source="ico/tag.png" Height="13" Width="13" />
        <Image x:Key="bugIcon" Source="ico/bug.png" Height="13" Width="13" />
        <Image x:Key="bugIcon2" Source="ico/bug2.png" Height="13" Width="13" />
        <Image x:Key="bugIcon3" Source="ico/bug3.png" Height="13" Width="13" />
        
        <ContextMenu x:Key="TermSetsContextMenu">
            <MenuItem Header="New Term Set" Command="customCommands:Commands.AddTermSetCommand" />
        </ContextMenu>
        <ContextMenu x:Key="SiteColumnsContextMenu">
            <MenuItem Header="New Site Column" Command="customCommands:Commands.AddSiteColumnCommand" />
        </ContextMenu>
        <ContextMenu x:Key="ContentTypeContextMenu">
            <MenuItem Header="New Content Type" Command="customCommands:Commands.AddContentTypeCommand" />
        </ContextMenu>
        <ContextMenu x:Key="TermContextMenu">
            <MenuItem Header="New Term" Command="customCommands:Commands.AddRootTermCommand" />
        </ContextMenu>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition />
        </Grid.RowDefinitions>
        
        <Menu Grid.Row="0">            
            <MenuItem Header="_File">
                <MenuItem Header="_New" Command="New" x:Name="Menu_New" />
                <MenuItem Header="_Open..." Command="Open" Icon="{StaticResource openIcon}" x:Name="Menu_Open" />
                <Separator />
                <MenuItem Header="_Save" Command="Save" Icon="{StaticResource saveIcon}" x:Name="Menu_Save" IsEnabled="False"/>
                <MenuItem Header="Save _As..." Command="SaveAs" InputGestureText="Ctrl+Shift+F" x:Name="Menu_SaveAs" IsEnabled="False"/>
                <Separator />
                <MenuItem Header="E_xit" Command="customCommands:Commands.ExitCommand" InputGestureText="Ctrl+X" />
            </MenuItem>
            <MenuItem Header="Pro_ject" x:Name="Menu_Project_Header" IsEnabled="False">
                <MenuItem Header="_Rename" Command="customCommands:Commands.RenameCommand" x:Name="Menu_Rename" IsEnabled="False"/>
                <MenuItem Header="_Generate Report" Command="customCommands:Commands.ReportCommand" x:Name="Menu_Report" IsEnabled="False" />
                <Separator />
                <MenuItem Header="SPFetch" Command="customCommands:Commands.SPFetchCommand" x:Name="Fetch_Menu" />
            </MenuItem>
            <!-- For use in an "integrated version
            <MenuItem Header="_SharePoint" x:Name="Menu_SharePoint" IsEnabled="False">
                <MenuItem Header="SPFetch" Command="customCommands:Commands.SPFetchCommand" x:Name="Fetch_Menu" />
                <MenuItem Header="Deploy Project" Command="customCommands:Commands.SPDeployCommand" x:Name="Deploy_Menu" />
            </MenuItem>
            -->
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Click="AboutClick"/>
                <Separator />
                <MenuItem Header="Developer">
                    <MenuItem Header="View Exception _Log" Click="ShowLog" />
                </MenuItem>
            </MenuItem>
        </Menu>
        <TabControl  Grid.Row="1">
            <TabItem x:Name="HomePageTab" Header="Getting Started">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                        <RowDefinition Height="30" />
                        <RowDefinition Height="30" />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="1">Step 1) Create a new project (File -> New [Ctrl+N])</Label>
                    <Label Grid.Row="2">Step 2) Choose a name for the project.</Label>
                    <Label Grid.Row="3">Step 3) Start creating Content Types.</Label>
                </Grid>
            </TabItem>
            <TabItem IsEnabled="False" x:Name="ContentTypesTab" Header="Content Types">
                <Grid Background="#FFFFFF">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" HorizontalAlignment="Left" FontWeight="Bold">Content Types:</Label>
                    <ListBox x:Name="ContentTypeList" Grid.Row="1" Margin="5" Padding="5" 
                             SelectionChanged="ContentTypeList_SelectionChanged" 
                             ContextMenu="{StaticResource ContentTypeContextMenu}"/>
                    <GroupBox Grid.Column="1" Grid.RowSpan="3" Padding="5" Margin="10"
                              FontWeight="Bold" x:Name="ContentTypeLabel" Header="No Content Type selected"
                              HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="120" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="35" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Name:</Label>
                            <TextBox Grid.Row="0" Grid.Column="1" Height="25" x:Name="ContentTypeFormName"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" />
                            
                            <Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Parent Type:</Label>
                            <ComboBox Grid.Row="1" Grid.Column="1" Height="25" x:Name="ContentTypeFormParent"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" SelectionChanged="ContentTypeChangedEvent"/>

                            <Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Group:</Label>
                            <DockPanel Grid.Row="2" Grid.Column="1">
                                <Button Padding="0" Height="20" Width="20" DockPanel.Dock="Right" Margin="5"
                                        x:Name="AddContentTypeButton" Click="AddContentTypeGroupButton_Click">+</Button>
                                <ComboBox Height="25" x:Name="ContentTypeFormGroup"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" SelectionChanged="ContentTypeGroupChangedEvent" />
                            </DockPanel>

                            <StackPanel Grid.Row="0" Grid.Column="2" Grid.RowSpan="3">
                                <Label HorizontalAlignment="Center" Padding="0">Notes</Label>
                                <TextBox x:Name="ContentTypeFormNotes" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" 
                                     FontWeight="Normal" HorizontalAlignment="Stretch" Height="80" Margin="10,2,10,0" 
                                     TextChanged="ContentTypeChangedEvent" />
                                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                                    <Label>Approved</Label>
                                    <CheckBox x:Name="ContentTypeFormApproved" VerticalAlignment="Center" 
                                              Unchecked="ContentTypeChangedEvent" Checked="ContentTypeChangedEvent" />
                                </StackPanel>
                            </StackPanel>

                            <Label Grid.ColumnSpan="2" Grid.Row="3" Margin="20,0,0,0">Inherited Fields:</Label>
                            
                            <DataGrid Grid.Row="4" Grid.ColumnSpan="3" Grid.RowSpan="1" AutoGenerateColumns="False"
                                      IsReadOnly="True" CanUserSortColumns="False" CanUserResizeRows="False"
                                      x:Name="InheritedContentTypeSiteColumnsGrid" DataContext="{x:Type DataModel:SiteColumn}" >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True" />
                                    
                                    <DataGridTemplateColumn Header="Required" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"
                                                          IsChecked="{Binding Required}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Unique" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"
                                                          IsChecked="{Binding Unique}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Type" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Label Content="{Binding TypeDisplayName}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Additional Info" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Image Source="{Binding AdditionInfoImageSource}" ToolTip="{Binding AdditionalInfoForToolTip}"
                                                       Opacity="{Binding AdditionalInfoOpacity}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>

                            <Label Grid.Row="5" Margin="20,0,0,0">Fields:</Label>
                            
                            <DataGrid Grid.Row="6" Grid.ColumnSpan="3" Grid.RowSpan="1" AutoGenerateColumns="False"
                                      IsReadOnly="False" CanUserSortColumns="False" CanUserResizeRows="False"
                                      x:Name="ContentTypeSiteColumnsGrid" DataContext="{x:Type DataModel:SiteColumn}" >
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True" />
                                    <DataGridTemplateColumn Header="Remove">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Click="RemoveContentTypeColumn" Width="20" Height="20" Padding="0">
                                                    <Image Source="ico/delete2.png" Height="13" Width="13" Margin="0" />
                                                </Button>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Required" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"
                                                          IsChecked="{Binding Required}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Unique" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"
                                                          IsChecked="{Binding Unique}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Type" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Label Content="{Binding Type}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Additional Info" IsReadOnly="True">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Image Source="{Binding AdditionInfoImageSource}" ToolTip="{Binding AdditionalInfoForToolTip}"
                                                       Opacity="{Binding AdditionalInfoOpacity}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridTextColumn Header="Default Value" Binding="{Binding DefaultVal}" />
                                    <DataGridTextColumn Header="Sample Value" Binding="{Binding SampleVal}" />
                                    <DataGridTextColumn Header="Description" Binding="{Binding Desc}" />                                    
                                </DataGrid.Columns>
                            </DataGrid>
                            
                            <StackPanel Grid.Row="7" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Center">
                                <Label VerticalContentAlignment="Center">Add a Site Column from:</Label>
                                <Button Margin="5" Padding="1" Click="ContentTypeAddSPSiteColumn_Click" x:Name="ContentTypeFormSPSiteColumnButton">Existing SharePoint</Button>
                                <Button Margin="5" Padding="1" Click="ContentTypeAddSiteColumn_Click" x:Name="ContentTypeFormSiteColumnButton">This Project</Button>
                                <Button Margin="5" Padding="1" Click="ContentTypeAddNewSiteColumn_Click" x:Name="ContentTypeFormNewSiteColumnButton">Create New</Button>
                            </StackPanel>
                            
                        </Grid>
                    </GroupBox>
                    <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button x:Name="ContentTypeButton_New" Click="ContentTypeButton_New_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/add_folder.png" Height="13" Width="13" />
                                <Label>New</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="ContentTypeButton_Rename" IsEnabled="False" Click="ContentTypeButton_Rename_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/edit.png" Height="13" Width="13" />
                                <Label>Rename</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="ContentTypeButton_Delete" IsEnabled="False" Click="ContentTypeButton_Delete_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/delete.png" Height="13" Width="13" />
                                <Label>Delete</Label>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem IsEnabled="False" x:Name="SiteColumnsTab" Header="Site Columns" GotFocus="SiteColumnsTab_GotFocus">
                <Grid Background="#FFFFFF">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" HorizontalAlignment="Left" FontWeight="Bold">Site Columns:</Label>
                    <ListBox x:Name="SiteColumnsList" Grid.Row="1" Margin="5" Padding="5" 
                             SelectionChanged="SiteColumnsList_SelectionChanged" 
                             ContextMenu="{StaticResource SiteColumnsContextMenu}"/>
                    <GroupBox Grid.Column="1" Grid.RowSpan="3" Padding="5" Margin="10"
                              FontWeight="Bold" x:Name="SiteColumnsLabel" Header="No site column selected"
                              HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition x:Name="SiteColAdditionalInfoRow" Height="1" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Display Name:</Label>
                            <DockPanel Grid.Row="0" Grid.Column="1">
                                <Button x:Name="scRenameBtn" IsEnabled="False" DockPanel.Dock="Right" Click="SiteColumnsButton_Rename_Click" Content="Rename" Margin="5"/>
                                <TextBox Height="25" x:Name="SiteColumnFormName"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" TextChanged="SiteColChangedEvent"/>
                            </DockPanel>
                            

                            <Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Internal Name:</Label>
                            <TextBox Grid.Row="1" Grid.Column="1" Height="25" x:Name="SiteColumnFormStaticName"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text=""/>

                            <Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Type:</Label>
                            <ComboBox Grid.Row="2" Grid.Column="1" Height="25" x:Name="SiteColumnFormType" 
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" SelectionChanged="SiteColumnFormType_SelectionChanged" />

                            <StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right"
                                   x:Name="SiteColAdditionalInfoRowLabelStackPanel"/>
                            <StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Stretch" Margin="0, 4, 0, 0"
                                   x:Name="SiteColAdditionalInfoStackPanel" />

                            <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center">
                                <Label VerticalContentAlignment="Center">Field is required:</Label>
                                <CheckBox x:Name="SiteColumnFormRequired" VerticalAlignment="Center" Unchecked="SiteColChangedEvent" Checked="SiteColChangedEvent"/>
                                <Label Width="30" />
                                <Label VerticalContentAlignment="Center">Enforce unique values:</Label>
                                <CheckBox x:Name="SiteColumnFormUnique" VerticalAlignment="Center" Unchecked="SiteColChangedEvent" Checked="SiteColChangedEvent"/>
                            </StackPanel>
                            
                            <Label Grid.Row="5" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Default Value:</Label>
                            <TextBox Grid.Row="5" Grid.Column="1" Height="25" x:Name="SiteColumnFormDefaultValue"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" TextChanged="SiteColChangedEvent" />
                            
                            <Label Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Sample Value:</Label>
                            <TextBox Grid.Row="6" Grid.Column="1" Height="25" x:Name="SiteColumnFormSampleValue"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" TextChanged="SiteColChangedEvent" />

                            <Label Grid.Row="7" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Group:</Label>
                            <DockPanel Grid.Row="7" Grid.Column="1">
                                <Button Padding="0" Height="20" Width="20" DockPanel.Dock="Right" Margin="5"
                                        x:Name="AddSiteColumnGroupButton" Click="AddSiteColumnGroupButton_Click">+</Button>
                                <ComboBox Height="25" x:Name="SiteColumnFormGroup"
                                     Padding="2" VerticalAlignment="Center" VerticalContentAlignment="Center"
                                     FontWeight="Normal" Text="" SelectionChanged="SiteColChangedEvent" />                                
                            </DockPanel>
                            

                            <StackPanel Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top">
                                <Label VerticalAlignment="Top" HorizontalAlignment="Center">Description</Label>
                                <TextBox x:Name="SiteColumnFormDesc" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" 
                                         FontWeight="Normal" HorizontalAlignment="Stretch" Height="120" Margin="10,2,10,0" 
                                         TextChanged="SiteColChangedEvent" />
                            </StackPanel>
                        </Grid>                        
                    </GroupBox>
                    <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button x:Name="SiteColumnsButton_New" Click="SiteColumnsButton_New_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/add_folder.png" Height="13" Width="13" />
                                <Label>New</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="SiteColumnsButton_Rename" IsEnabled="False" Click="SiteColumnsButton_Rename_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/edit.png" Height="13" Width="13" />
                                <Label>Rename</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="SiteColumnsButton_Delete" IsEnabled="False" Click="SiteColumnsButton_Delete_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/delete.png" Height="13" Width="13" />
                                <Label>Delete</Label>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem IsEnabled="False" x:Name="ManagedMetaDataTab" Header="Managed Metadata">
                <Grid Background="#FFFFFF">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" HorizontalAlignment="Left" FontWeight="Bold">Term Sets:</Label>
                    <ListBox x:Name="ManagedMetaDataTermSetList" Grid.Row="1" Margin="5" Padding="5" 
                             SelectionChanged="ManagedMetaDataTermSetList_SelectionChanged" 
                             ContextMenu="{StaticResource TermSetsContextMenu}"/>
                    <Label Grid.Column="1" HorizontalAlignment="Left" FontWeight="Bold" x:Name="ManagedMetadataTermSetLabel">No term set selected</Label>
                    <TreeView x:Name="ManagedMetaDataTermSetTermTree" Grid.Row="1" Grid.Column="1" Margin="5" Padding="5" 
                              ContextMenu="{StaticResource TermContextMenu}" SelectedItemChanged="ManagedMetaDataTermSetTermTree_SelectedItemChanged" />
                    <StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Margin="0,5,22,0" Opacity="0.7">
                        <Label Padding="1" HorizontalAlignment="Center" BorderThickness="0,0,0,1" BorderBrush="Black">Legend</Label>
                        <Label Padding="2" FontStyle="Italic">Untaggable</Label>
                        <Label Padding="2" FontWeight="Bold">Taggable</Label>
                        <Border Padding="0" CornerRadius="2" BorderThickness="2" BorderBrush="LightBlue" Background="#FFD1ECF5">
                            <Label Margin="0" Padding="0" FontWeight="Bold">
                                In use
                            </Label>
                        </Border>                        
                    </StackPanel>
                    <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
                        <Button x:Name="ManagedMetaDataTermSetButton_New" Click="ManagedMetaDataTermSetButton_New_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/add_folder.png" Height="13" Width="13" />
                                <Label>New</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="ManagedMetaDataTermSetButton_Rename" IsEnabled="False" Click="ManagedMetaDataTermSetButton_Rename_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/edit.png" Height="13" Width="13" />
                                <Label>Rename</Label>
                            </StackPanel>
                        </Button>
                        <Label Width="2"></Label>
                        <Button x:Name="ManagedMetaDataTermSetButton_Delete" IsEnabled="False" Click="ManagedMetaDataTermSetButton_Delete_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="ico/delete.png" Height="13" Width="13" />
                                <Label>Delete</Label>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                    <Grid Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                            <Label Width="10" />
                            <Button IsEnabled="False" Command="customCommands:Commands.AddRootTermCommand" x:Name="ManagedMetaDataTermButton_NewRoot">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="ico/plus.png" Height="13" Width="13" />
                                    <Label>New Root Term</Label>
                                </StackPanel>
                            </Button>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <Button IsEnabled="False" Command="customCommands:Commands.AddTermCommand" x:Name="ManagedMetaDataTermButton_AddTerm">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="ico/plus.png" Height="13" Width="13" />
                                    <Label>Add Child Term</Label>
                                </StackPanel>
                            </Button>
                            <Label Width="5"/>
                            <Button IsEnabled="False" Command="customCommands:Commands.RenameTermCommand" x:Name="ManagedMetaDataTermButton_RenameTerm">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="ico/edit.png" Height="13" Width="13" />
                                    <Label>Rename Term</Label>
                                </StackPanel>
                            </Button>
                            <Label Width="5"/>
                            <Button IsEnabled="False" Command="customCommands:Commands.DeleteTermCommand" x:Name="ManagedMetaDataTermButton_DeleteTerm">
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="ico/delete.png" Height="13" Width="13" />
                                    <Label>Delete Term</Label>
                                </StackPanel>
                            </Button>
                            <Label Width="10" />
                        </StackPanel>
                    </Grid>
                </Grid>
            </TabItem>
        </TabControl>        
    </Grid>
</Window>
